home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
SGI Hot Mix 17
/
Hot Mix 17.iso
/
HM17_SGI
/
research
/
lib
/
get_screen_size.pro
< prev
next >
Wrap
Text File
|
1997-07-08
|
2KB
|
70 lines
; $Id: get_screen_size.pro,v 1.4 1997/03/11 21:43:45 griz Exp $
; Copyright (c) 1997, Research Systems, Inc. All rights reserved.
; Unauthorized reproduction prohibited.
;
;+
; FILE:
; get_screen_size.pro
;
; PURPOSE:
; This application retrieves the screen size for the current
; (or specified) display.
;
; CATEGORY:
; Graphics
;
; CONTENTS:
; fun get_screen_size - retrieves the screen size
;
; NAMED STRUCTURES:
; none.
;
; COMMON BLOCKS:
; none.
;
; MODIFICATION HISTORY:
; 10/96 DD - Original.
; 01/97 DD - Use an unmapped widget draw rather than a pixmap
; window because in some (rare) cases on certain X
; window configurations, a GL pixmap context cannot
; be supported.
;
;-
; -----------------------------------------------------------------------------
;
; Purpose: Returns a two-element vector of the form [width, height] that
; represents the dimensions, measured in device units, of the
; screen.
;
; X Only: The DISPLAY_NAME keyword may be set to a string
; indicating the name of the X WIndows display
; that should be used to determine the screen size.
;
FUNCTION get_screen_size, display_arg, DISPLAY_NAME=display_name
; Set default display name.
IF (N_ELEMENTS(display_arg) EQ 0) THEN BEGIN
IF (N_ELEMENTS(display_name) EQ 0) THEN $
inDisplayName = "" $
ELSE $
inDisplayName = display_name
ENDIF ELSE $
inDisplayName = display_arg
wBase = WIDGET_BASE(MAP=0)
wDraw = WIDGET_DRAW(wBase, XSIZE=10, YSIZE=10, GRAPHICS_LEVEL=2, $
DISPLAY_NAME=inDisplayName)
; Create a small pixmap on the given display.
WIDGET_CONTROL, wBase, /REALIZE
WIDGET_CONTROL, wDraw, GET_VALUE=oWindow
; Retrieve the screen dimensions.
oWindow->GetProperty, SCREEN_DIMENSIONS=screenDims
; Clean up.
WIDGET_CONTROL, wBase, /DESTROY
; Return the screen dimensions.
RETURN, screenDims
END